package com.fnzx.service.impl;

import com.fnzx.dao.NasLinkDao;
import com.fnzx.entity.ArticleEntity;
import com.fnzx.entity.NasLinkEntity;
import com.fnzx.service.NasLinkService;
import com.fnzx.util.PageUtils;
import com.fnzx.util.Query;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

@Service("nasLinkService")
public class NasLinkServiceImpl extends ServiceImpl<NasLinkDao, NasLinkEntity> implements NasLinkService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<NasLinkEntity> page = this.page(
                new Query<NasLinkEntity>().getPage(params),
                new QueryWrapper<NasLinkEntity>()
        );

        return new PageUtils(page);
    }
    @Override
    public PageUtils queryPageByTitle(Map<String, Object> params) {
        QueryWrapper<NasLinkEntity> queryWrapper = new QueryWrapper<NasLinkEntity>();
        if (params.get("title") != null && params.get("title") != "") {
            queryWrapper.like("title",params.get("title"));
        }
        IPage<NasLinkEntity> page = this.page(
                new Query<NasLinkEntity>().getPage(params),
                queryWrapper
        );
        return new PageUtils(page);
    }
}